package com.example.blog.config;

import com.example.blog.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExceptionAdvice {
    @ExceptionHandler()
    public Result handleException(Exception e) {
        log.error("发生异常，e:{}",e.getMessage());
        return Result.failure(e.getMessage());
    }
}
